#define TXSIZE 32

typedef struct Txbuffer {
  unsigned char buffer[TXSIZE];
  unsigned char head;
  unsigned char tail;
  unsigned char count;
} Txbuffer;

/** Usart globals **/
extern volatile unsigned char cmd[32];        // receive buffer
extern volatile unsigned char usart_index;  // receive buffer index
extern volatile unsigned char usart_rdy;    // receive flag
extern volatile Txbuffer txbuffer;

void usart_open(unsigned int spbrg);
void send_byte(unsigned char c);
void send_string(char *s);
void send_u24(unsigned long);
void send_u12(unsigned int);
void send_u8(unsigned char);
unsigned long get_u8(void);
unsigned long get_u24(void);
